;;; Find the largest palindrome made from the product of two 3-digit numbers.
;;;
(defun p4 ()
  (apply
	'max
	(palin-list 100 999)))

(defun palindromic? (n)
  (= n (parse-integer (reverse (write-to-string n)))))

(defun palin-list (lower-limit upper-limit)
  (remove-if-not
	'palindromic?
	  (rangex lower-limit upper-limit '*)))
 
(defun rangex (start end op)
  (loop for x from start to end
		append (loop for y from start to end
					  collect (apply op (list x y)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(format t "~a~%" (palindromic? 9009))
;(format t "~a~%" (time (palin-list 100 999)))
(format t "~a~%" (time (p2)))

